import React from 'react';
import {render} from 'react-dom';

class TodoList extends React.Component{

	constructor(props){
		super(props);
		this.remove=this.remove.bind(this);
	}

	remove(index){
		this.props.remove(index);
	}

	render(){
		var that=this;
		var item=this.props.list.map((item,index)=>{
			return (
				<li key={index}>
					{item}
					<button onClick={this.remove.bind(that,index)}>贱人</button>
				</li>
			)
		})
		return(
			<ul>
				{item}
			</ul>
		)
	}
}

export default TodoList;